import {request} from '@/utils/request'
import {saveAs} from 'file-saver';

// 查询附件信息（受理单）列表
export function listAttament(query) {
  return request({
    url: '/common/attachment/list/all/',
    method: 'get',
    params: query
  })
}


// 新增附件信息（受理单）
export function createAttament(data) {
  return request({
    url: '/common/attachment/add',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data; charset=utf-8'
    }
  },{
    successMsg:"上传成功！"
  })
}



// 删除附件信息（受理单）
export function deleteAttament(id) {
  return request({
    url: '/common/attachment/' + id,
    method: 'delete'
  },{
    successMsg:"删除成功！"
  })
}

// 删除附件信息（受理单）
export function downloadAttament(id) {
  return request({
    url: '/common/attachment/download/' + id,
    method: 'get',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    responseType: 'blob',
  }).then(async (response) => {
    const blob = new Blob([response]);
    saveAs(blob, "111");
  })
}




